package com.gosophia.logContent.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.web.action.BaseSupportAction;
import com.gosophia.logManagement.dto.LogContentDTO;
import com.gosophia.logManagement.ws.LogManagementWebService;

@Scope("prototype")
@Controller("GetLogContentAction")
public class GetLogContentAction extends BaseSupportAction{

	private static final long serialVersionUID = 8347292572388466871L;

	@Autowired
	private LogManagementWebService logManagementWebService;

	private Long logContentId;

	private LogContentDTO logContentDTO = new LogContentDTO();  	

	public Long getLogContentId() {
		return logContentId;
	}

	public void setLogContentId(Long logContentId) {
		this.logContentId = logContentId;
	}

	public LogContentDTO getLogContentDTO() {
		return logContentDTO;
	}

	public void setLogContentDTO(LogContentDTO logContentDTO) {
		this.logContentDTO = logContentDTO;
	}

	@Override
	public String _execute() throws Exception {
		logContentDTO = logManagementWebService.findLogContentBylogContentId(logContentId);
		if(logContentDTO!=null) {
			super.getRequestResult().setRsltCode("0");
		} else {
			super.getRequestResult().setRsltCode("1");
		}
		
		return SUCCESS;
	}

}
